/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "estadia")
@NamedQueries({
    @NamedQuery(name = "Estadia.findAll", query = "SELECT e FROM Estadia e")})
public class Estadia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_estadia")
    private Integer idEstadia;
    @Basic(optional = false)
    @Column(name = "dia_ingreso")
    @Temporal(TemporalType.TIMESTAMP)
    private Date diaIngreso;
    @Basic(optional = false)
    @Column(name = "dia_egreso")
    @Temporal(TemporalType.TIMESTAMP)
    private Date diaEgreso;
    @Column(name = "hora_egreso")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaEgreso;
    @Basic(optional = false)
    @Column(name = "responsable")
    private int responsable;
    @ManyToMany(mappedBy = "estadiaList")
   @LazyCollection(LazyCollectionOption.FALSE)
    private List<Pasajero> pasajeroList;
    @LazyCollection(LazyCollectionOption.FALSE)
    @OneToMany(mappedBy = "idEstadia")
    private List<Factura> facturaList;
    @JoinColumn(name = "habitacion", referencedColumnName = "numero")
    @ManyToOne(optional = false)
    private Habitacion habitacion;
    @OneToMany(mappedBy = "estadia")
     @LazyCollection(LazyCollectionOption.FALSE)
    private List<Consumo> consumoList;

    public Estadia() {
    }

    public Estadia(Integer idEstadia) {
        this.idEstadia = idEstadia;
    }

    public Estadia(Integer idEstadia, Date diaIngreso, Date diaEgreso, int responsable) {
        this.idEstadia = idEstadia;
        this.diaIngreso = diaIngreso;
        this.diaEgreso = diaEgreso;
        this.responsable = responsable;
    }

    public Integer getIdEstadia() {
        return idEstadia;
    }

    public void setIdEstadia(Integer idEstadia) {
        this.idEstadia = idEstadia;
    }

    public Date getDiaIngreso() {
        return diaIngreso;
    }

    public void setDiaIngreso(Date diaIngreso) {
        this.diaIngreso = diaIngreso;
    }

    public Date getDiaEgreso() {
        return diaEgreso;
    }

    public void setDiaEgreso(Date diaEgreso) {
        this.diaEgreso = diaEgreso;
    }

    public Date getHoraEgreso() {
        return horaEgreso;
    }

    public void setHoraEgreso(Date horaEgreso) {
        this.horaEgreso = horaEgreso;
    }

    public int getResponsable() {
        return responsable;
    }

    public void setResponsable(int responsable) {
        this.responsable = responsable;
    }

    public List<Pasajero> getPasajeroList() {
        return pasajeroList;
    }

    public void setPasajeroList(List<Pasajero> pasajeroList) {
        this.pasajeroList = pasajeroList;
    }

    public List<Factura> getFacturaList() {
        return facturaList;
    }

    public void setFacturaList(List<Factura> facturaList) {
        this.facturaList = facturaList;
    }

    public Habitacion getHabitacion() {
        return habitacion;
    }

    public void setHabitacion(Habitacion habitacion) {
        this.habitacion = habitacion;
    }

    public List<Consumo> getConsumoList() {
        return consumoList;
    }

    public void setConsumoList(List<Consumo> consumoList) {
        this.consumoList = consumoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadia != null ? idEstadia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estadia)) {
            return false;
        }
        Estadia other = (Estadia) object;
        if ((this.idEstadia == null && other.idEstadia != null) || (this.idEstadia != null && !this.idEstadia.equals(other.idEstadia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Estadia[ idEstadia=" + idEstadia + " ]";
    }
    
}
